<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	  layout:decorate="layout/admin_main">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<title>运营中心 | 系统角色</title>
</head>

<body th:with="cur='sel-sys',cur_sub='sel-role'">

<th:block layout:fragment="content">
<div class="page-content-wrapper">
	<div class="page-content">
		
		<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
				<!-- 	<h3 class="page-title">
					Managed Datatables <small>managed datatable samples</small>
					</h3>  -->
					<ul class="page-breadcrumb breadcrumb">
						<li>
							<i class="fa fa-home"></i>
							<a href="/admin/index.shtml">首页</a>
							<i class="fa fa-angle-right"></i>
						</li>
						<li>
							<a href="/admin/sys/listSystemRole.shtml">系统角色</a>
						</li>
					</ul>
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			
			<div class="portlet-body">
			     <form action="/admin/sys/listSystemRole.shtml" id="pageForm" method="post">
		    		<input type="hidden" name="page"  th:attr="value=${pageBean.page}" id="pageNo">

					 <div class="table-toolbar">
						 <div class="input-group">
							 <label>状态:</label>
							 <select name="filters[status]" class="form-control input-small">
								 <option value="ENABLE" th:selected="${pageBean.filters.status == 'ENABLE'}">启用</option>
								 <option value="DISABLE" th:selected="${pageBean.filters.status == 'DISABLE'}">禁用</option>
								 <option value="DELETE" th:selected="${pageBean.filters.status == 'DELETE'}">删除</option>
							 </select>
							 <span>&nbsp;</span>
							 <button type="submit" class="btn btn-sm blue">查询<i class="fa fa-search"></i></button>
						 </div>
					 </div>
				</form>
				<div class="table-toolbar">
					<a href="/admin/sys/toEditSystemRole.shtml" class="btn btn-sm green"><i class="fa fa-plus"></i>新增角色</a>
				</div>
				<table class="table table-striped table-bordered table-hover dataTable">
				<thead>
				<tr role="row">
				    <th width="5%">序号</th>
					<th width="10%">名称</th>
					<th width="20%">权限</th>
					<th width="5%">状态</th>
					<th width="8%">创建人</th>
					<th width="15%">创建时间</th>
					<th width="8%">更新人</th>
					<th width="15%">更新时间</th>
					<th width="14%">操作</th>
				</tr>
				</thead>
				<tbody>

				<tr th:each="role, vs:${roles}">
					<td th:text="${vs.count}"></td>
					<td th:text="${role.name}"></td>
					<td>
						<span th:each="module, vs:${role.modules}" th:text="${module.title}+ (${vs.last} ? '' : ',')">
						</span>
					</td>
					<td>
						<span th:if="${role.status == 'ENABLE'}">启用</span>
						<span th:if="${role.status == 'DISABLE'}">禁用</span>
						<span th:if="${role.status == 'DELETE'}">删除</span>
					</td>
					<td th:text="${T(com.hawk.springboot.base.BeanDataFactory).getAdminById(role.createUserId)?.account}">
					</td>
					<td th:text="${#calendars.format(role.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
					<td th:text="${T(com.hawk.springboot.base.BeanDataFactory).getAdminById(role.updateUserId)?.account}">
					</td>
					<td th:text="${#calendars.format(role.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
					<td>
						<a th:href="@{toEditSystemRole.shtml(id=${role.id})}" class="btn btn-sm purple"><i class="fa fa-edit"></i> 编辑</a>
						<a th:if="${role.status != 'DELETE'}" th:href="@{'javascript:deleteRole(\''+${role.id}+'\')'}" class="btn btn-sm default"><i class="fa fa-times"></i> 删除</a>
					</td>
				</tr>

				</tbody>
				</table>
				</div>
				<div class="row" th:utext="${pageBean.adminPageNavigation}">
				</div>
		</div>
</div>
<script src="/common/js/paging.js?v=${version}" type="text/javascript"></script>
<script>
function deleteRole(id) {
	var url = "/admin/sys/deleteSystemRole.shtml?id="+id;
	confirmDeleteData("真的需要删除吗？", url);
}
</script>
<div th:replace="/common/bootbox"></div>
</th:block>
</body>
</html>